package com.steakliu.sun.demo.client.sundemoclientspringboot.component;

import com.steakliu.sun.annotation.SunReference;
import com.steakliu.sun.demo.api.PostService;
import com.steakliu.sun.demo.api.UserService;
import com.steakliu.sun.demo.client.sundemoclientspringboot.fallback.UserServiceFallbackHandler;
import com.steakliu.sun.protocol.context.RpcContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 功能说明：
 * <p>
 * Original @Author: steakliu-刘牌, 2023-01-14  16:16
 * <p>
 * Copyright (C)2020-2022  steakliu All rights reserved.
 */
@Component
public class UserServiceComponent {

    @SunReference(fallbackClass = UserServiceFallbackHandler.class, async = false)
    private UserService userService;

    @SunReference
    private PostService postService;

    public String getUser(String name){
        return userService.getUser(name);
        //return RpcContext.getContext().get().toString();
    }
}
